home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / lbot_scripts.lua < prev    next >
Encoding:
Text File  |  2009-04-27  |  5.4 KB  |  160 lines

  1.  
  2. function units_lbot_setup()
  3.     units_setup(4,false,ENET_EFFECT_PS_SETUPSMOKE_SMALL,ENET_EFFECT_GEOMETRY_SMALLROBOTSHADOW)
  4. end
  5.  
  6. function units_lbot_resetup()
  7.     units_setup(4,false,nil,ENET_EFFECT_GEOMETRY_SMALLROBOTSHADOW)
  8. end
  9.  
  10. function units_lbot_select()
  11.     units_select(12,1)
  12. end
  13.  
  14. function units_lbot_unselect()
  15.     units_unselect()
  16. end
  17.  
  18. function units_lbot_selectenemy()
  19.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  20. end
  21.  
  22. function units_lbot_damaged()
  23.     uniGetExecutor():applyDamage(uniGetLife())
  24. end
  25.  
  26. function units_lbot_highlight()
  27.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  28. end
  29.  
  30. function units_lbot_explode()
  31.     units_explode_small2()
  32. end
  33.  
  34. function units_lbot_move()
  35.     local unit = uniGetExecutor()
  36.     local sound = unit:play3DSound(units_getRandomSoundName(SND_LBOT,SNDT_MOVE),1)
  37.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 1.8))
  38.     local steps = {}
  39.     local stepsmoke = {}
  40.     local i = 0;
  41.     for i = 0,2 do
  42.         steps[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_WHEELSTEPSEMITTER)
  43.         stepsmoke[i] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_NEWTRACKSMOKE5)
  44.     end
  45.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  46.     for i = 0,2 do
  47.         if(unit:getScale() < 1.0) then 
  48.             steps[i]:destroy()
  49.         else
  50.             steps[i]:setTransformOwner()
  51.             steps[i]:suspendedDestroy(70)
  52.         end
  53.             stepsmoke[i]:suspendedDestroy(5)
  54.     end
  55.     sound:destroy()
  56. end
  57.  
  58. function units_lbot_fire()
  59.     local unit = uniGetExecutor()
  60.     wait_for_platform(unit)
  61.     uniSetLife(uniGetLife() / 3.0)
  62.     local gt = unit:getBone(ENBT_GUNTOWER)
  63.     local sound = gt:play3DSound("smallrobot_guntower_rotate.wav",1)
  64.     waitDeath(gt:addRotationEffect(ENET_EFFECT_ROTATE_GUNTOWERTOTARGET,MATH_PI,uniGetTarget()))
  65.     sound:stopSound()
  66.     local firespot = gt:getBone(ENBT_FIRE1)
  67.     waitDeath(gt:aimGun(0,MATH_PI / 3.0,uniGetTarget()))
  68.     local i = 0
  69.     for i = 0,2 do
  70.         gt:play3DSound("smallrobot_fire.wav",0):destroy()
  71.         local shot1 = firespot:addBulletEffect(ENET_EFFECT_BULLET_BLUELASERBOLT)
  72.         shot1:executeCommand(ENC_FIRE1)
  73.         gt:gunRecoil(0,0.1,4)
  74.         pause(0.1)
  75.     end
  76.     unit:addFireArrow()
  77. end
  78.  
  79. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_MOVE,"units_lbot_move")
  80. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_FIRE1,"units_lbot_fire")
  81. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_FIRE2,"units_lbot_fire")
  82. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_SELECT,"units_lbot_select")
  83. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_SELECTENEMY,"units_lbot_selectenemy")
  84. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_UNSELECT,"units_lbot_unselect")
  85. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_SETUP,"units_lbot_setup")
  86. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_RESETUP,"units_lbot_resetup")
  87. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_DAMAGED,"units_lbot_damaged")
  88. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_EXPLODE,"units_lbot_explode")
  89. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_HIGHLIGHT,"units_lbot_highlight")
  90. registerCommand(ENSCRIPTSET_SMALLROBOT,ENC_INSIDE,"units_inside")
  91.  
  92. -- make description of unit
  93. desc = getEffectDescriptionP(ENET_UNIT_SMALLROBOT)
  94. desc.ClassID = ENCLASS_MESHINSTANCE
  95. desc.EffectClassType = ENECT_GEOMETRY
  96. desc.FileName = "smallrobot.rmd"
  97. desc.ScriptSet = ENSCRIPTSET_SMALLROBOT
  98. desc.MoveType = ENMOVE_GROUNDORIENTED
  99. desc.RenderType = ENRENDERTYPE_GEOMETRY
  100. desc.Material = ENMAT_RIGIDSKINNEDMESH
  101. desc.MaterialColors = units_materialcolors_human
  102.  
  103. -- shadow
  104. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_SMALLROBOTSHADOW)
  105. desc.ClassID = ENCLASS_MESHINSTANCE
  106. desc.EffectClassType = ENECT_GEOMETRY
  107. desc.FileName = "smallrobot_shadow.rmd"
  108. desc.RenderType = ENRENDERTYPE_SHADOW
  109. desc.Material = ENMAT_SHADOW
  110. desc.MaterialColors = units_materialcolors_shadow
  111.  
  112. -- register new unit to logic
  113. unitDesc = logic_getUnitDescP(0)
  114. unitDesc.group = 0
  115. unitDesc.order = 0
  116. unitDesc.unit_res_id = ENET_UNIT_SMALLROBOT
  117. unitDesc.unit_icon_id = "Smallrobot_h_small_normal.dds"
  118. unitDesc.active_id = "Smallrobot_h_small_active.dds"
  119. unitDesc.pressed_id = "Smallrobot_h_small_pressed.dds"
  120. unitDesc.big_icon_id = "Smallrobot_h_big_normal.dds"
  121. unitDesc.small_icon_id = "Smallrobot_u_stats.dds"
  122. unitDesc.HP = 4
  123. unitDesc.MP = 10
  124. unitDesc.WR = 1
  125. unitDesc.min_WR = 1
  126. unitDesc.WD = 1
  127. unitDesc.WR2 = 0
  128. unitDesc.min_WR2 = 0
  129. unitDesc.WD2 = 0
  130. unitDesc.ability = 0
  131. unitDesc.transport = 0
  132. unitDesc.value = 1
  133. unitDesc.race = 0
  134. unitDesc.fire_pause = 0.2
  135. unitDesc.move_pause = 0.5
  136. unitDesc.unit_info_scale = 0.08
  137. unitDesc.scn_name = "LBOT"
  138.  
  139. ------------------------------------------------------------------------------------------------------
  140. ------------------------ effects related to unit------------------------------------------------------
  141. ------------------------------------------------------------------------------------------------------
  142.  
  143. function bullets_bluelaserbolt_fire()
  144.     local bullet = uniGetExecutor()
  145.     bullet:setTransformOwner()
  146.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_BLUELASERBOLTFLY)
  147.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_BLUELASERBOLT)
  148.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,400,uniGetTarget()),1000)
  149.     light:destroy()
  150.     track:destroy()
  151.     local hit_ps = bullet:addSimpleEffect(ENET_EFFECT_PS_BLUELASERBOLTHIT)
  152.     pause(0.2)
  153.     hit_ps:suspendedDestroy(1.0)
  154.     uniGetTarget():executeCommand(ENC_DAMAGED)
  155.     pause(1.0)
  156.     bullet:destroy()
  157. end
  158.  
  159. registerCommand(ENSCRIPTSET_BULLET_BLUELASERBOLT,ENC_FIRE1,"bullets_bluelaserbolt_fire")
  160.